/**
 * Created by admin on 2017/4/6.
 */
function deleteThis(id,url){
    var isTrue = confirm("确定要删除？");
    if(isTrue == true){
        $.ajax({
            type:"POST",
            url:url+"?",
            data:{"admin_id" : id},
            dataType:'json',
            success:function(data){
                if(data.status == 200){
                    alert("成功！");
                    window.location.reload();
                }else{
                    alert(data.info);
                    return false;
                }
            },
            error: function () {
                alert("服务端出错！");
                return false;
            }
        });
    }
}

/**
 * 编辑工人信息
 * @param id                id
 * @param name              姓名
 * @param phone             电话
 * @param login_name        登录名
 * @param login_password    登录密码
 */
function updateThis(id,name,phone,login_name,login_password){
    document.getElementById("info_id").value = id;
    document.getElementById("info_name").value = name;
    document.getElementById("info_phone").value = phone;
    document.getElementById("info_login_name").value = login_name;
    document.getElementById("info_login_password").value = login_password;
    $("#editAdminInfo").modal({
        "backdrop":"static",
        "keyboard":"true"
    });
}


/**
 * 编辑工程师信息
 * @param id                id
 * @param name              姓名
 * @param phone             电话
 * @param login_name        地址
 */
function updateEngineerPhone(id,name,phone,login_name){
    document.getElementById("phone_id").value = id;
    document.getElementById("phone_name").value = name;
    document.getElementById("phone_phone").value = phone;
    document.getElementById("phone_address").value = login_name;
    $("#editEngineerPhone").modal({
        "backdrop":"static",
        "keyboard":"true"
    });
}

/**
 *
 * @param id
 * @param name
 * @param price
 * @param back
 */
function updateMaintain(id,name,price,back){
    document.getElementById("project_id").value = id;
    document.getElementById("project_content").value = name;
    document.getElementById("project_price").value = price;
    document.getElementById("project_back").value = back;
    $("#editMaintain").modal({
        "backdrop":"static",
        "keyboard":"true"
    });
}

function changeLableMenu(url) {
    var id = $("#service_class_key").val();
    window.location.href = url+'?service_class='+id+"&page=1";
}

function thisDeltail(id,url,idname) {
    window.location.href = url+'?'+idname+'='+id;
}
